import request from '@/utils/request'
/**
 * 获取员工列表
 * @param {*} page 页数
 * @param {*} size 页码
 * @returns
 */
export const getEmployeeListApi = (page, size) => {
  return request({
    url: `/sys/user`,
    params: {
      page,
      size
    }
  })
}
/**
 * 删除员工
 * @param {*} id 员工id
 * @returns
 */
export const delEmployeeApi = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'DELETE'
  })
}
/**
 * 添加员工的接口
 * @param {*} data 员工数据
 * @returns
 */
export const addEmployeeApi = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}
/**
 * excel员工列表导入的接口
 * @param {*} list excel员工数据
 * @returns
 */
export const batchAddEmployeeApi = (list) => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data: list
  })
}
/**
 * 修改员工信息
 * @param {} data 员工的所有信息
 * @returns
 */
export const editEmployeeApi = (data) => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'PUT',
    data
  })
}

export const assignRoleApi = (id, doleIds) => {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'PUT',
    data: {
      id, doleIds
    }
  })
}
